#!/usr/bin/env bash

set -eo pipefail -o nounset

function deisctl-tunnel {
  local port="$(vagrant ssh-config deis-01 \
              | grep Port \
              | awk '{print $2}')"
  local ip="$(vagrant ssh-config deis-01 \
              | grep HostName \
              | awk '{print $2}')"
  echo "${ip}:${port}"
}

(
  cd ${DEIS_ROOT}
  vagrant up --provider virtualbox
)

export DEISCTL_TUNNEL="$(deisctl-tunnel)"
rigger-save-vars DEISCTL_TUNNEL
